package cn.com.mypos.to.sale;

import java.io.Serializable;

import cn.com.infostrategy.bs.common.CommDMO;
import cn.com.infostrategy.to.common.HashVO;
import cn.com.infostrategy.to.common.TBUtil;
import cn.com.infostrategy.ui.common.UIUtil;

public class DealCFBarCodeBean implements Serializable {
	private String barCode;
	
	public String getBarCode() {
		return barCode;
	}

	public void setBarCode(String barCode) {
		this.barCode = barCode;
	}

	public String getBill_info_id() {
		return bill_info_id;
	}

	public void setBill_info_id(String billInfoId) {
		bill_info_id = billInfoId;
	}

	private String bill_info_id;

	public HashVO getCFLensVO(String barcode) throws Exception {
		this.barCode = barcode;
		bill_info_id = barcode.substring(4);
		HashVO orderinfo_vo[] = getHashVoArrayByDS(null, "select * from cs_lens_purchase_order_info where bill_info_id = " + Integer.parseInt(bill_info_id));
		if (orderinfo_vo.length == 0) {
			return null;
		}
		return orderinfo_vo[0];
	}

	private HashVO[] getHashVoArrayByDS(String _dbsource, String _sql) throws Exception {
		HashVO getVos[] = (HashVO[]) null;
		if (TBUtil.JVMSITE_SERVER == TBUtil.getTBUtil().getJVSite())
			getVos = (new CommDMO()).getHashVoArrayByDS(null, _sql.toString());
		else
			getVos = UIUtil.getHashVoArrayByDS(null, _sql.toString());
		return getVos;
	}
}
